﻿using Furion.ConfigurableOptions;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Furionss.Application
{
    public class AppInfoOptions : IConfigurableOptions<AppInfoOptions>
    {

        [Required(ErrorMessage = "名称不能为空")]
        public string Name { get; set; }
        [Required, RegularExpression(@"^[0-9][0-9\.]+[0-9]$", ErrorMessage = "不是有效的版本号")]
        public string Version { get; set; }
        [Required, MaxLength(100)]
        public string Company { get; set; }



        public void PostConfigure(AppInfoOptions options, IConfiguration configuration)
        {
            options.Name ??= "Furion";
            options.Version ??= "1.0.01";
            options.Company ??= "Baiqian";
        }

    }
}
